package com.mbps.cd.userservice.web;

import com.mbps.cd.userservice.domain.User;
import com.mbps.cd.userservice.domain.UserRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author EdisonZhou
 */
@RestController
public class UserController {
    @Autowired
    private UserRepository userRepository;

    private static final Logger logger = LoggerFactory.getLogger(UserController.class);

    @RequestMapping(value = "/{id}", method = RequestMethod.GET)
    public User findById(@PathVariable Long id){
        User user = new User();
        user.setId(id);
        user.setUsername("崔浩");

        logger.info("调用8002");

        return user;

        /*User result = userRepository.findOne(id);
        return result;*/
    }

}
